package com.atguigu.mall.weball.controller;

import com.atguigu.gmall.feign.order.OrderFeignClient;
import com.atguigu.gmall.order.entity.OrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class paymentController {
    @Autowired
    private OrderFeignClient  client;
   @GetMapping("/pay.html")
    public String  payPage(@RequestParam("orderId") Long orderId, Model model){
     //远程调用 订单服务 将订单数据查出来
       OrderInfo orderInfo = client.getOrderById(orderId).getData();
       model.addAttribute("orderInfo",orderInfo);

      return  "payment/pay";
    }

    /**
     * 支付成功提示页
     * @return
     */
    @GetMapping("/pay/success.html")
    public  String paySuccess(){

        return  "payment/success.html";
    }


}
